home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML Authority.sea / XML Authority / Required / ccs_util.jar / test / ui / AboutDialog.class (.txt) next >
Encoding:
Java Class File  |  1999-12-09  |  6.7 KB  |  242 lines

  1. package test.ui;
  2.  
  3. import java.awt.Button;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Dialog;
  7. import java.awt.Font;
  8. import java.awt.Frame;
  9. import java.awt.GridBagConstraints;
  10. import java.awt.GridBagLayout;
  11. import java.awt.Insets;
  12. import java.awt.Label;
  13. import java.awt.Window;
  14. import java.awt.event.ActionEvent;
  15. import java.awt.event.ActionListener;
  16. import java.awt.event.WindowEvent;
  17. import java.awt.event.WindowListener;
  18. import java.lang.reflect.Constructor;
  19. import java.util.EventObject;
  20.  
  21. class AboutDialog extends Dialog implements ActionListener, WindowListener {
  22.    private Button ivjButton1;
  23.    private Label ivjLabel1;
  24.    private Label ivjLabel2;
  25.    private Logo ivjLogo1;
  26.    // $FF: synthetic field
  27.    static Class class$java$awt$Window;
  28.  
  29.    public AboutDialog(Frame parent) {
  30.       super(parent);
  31.       this.initialize();
  32.    }
  33.  
  34.    public AboutDialog(Frame parent, String title) {
  35.       super(parent, title);
  36.    }
  37.  
  38.    public AboutDialog(Frame parent, String title, boolean modal) {
  39.       super(parent, title, modal);
  40.    }
  41.  
  42.    public AboutDialog(Frame parent, boolean modal) {
  43.       super(parent, modal);
  44.    }
  45.  
  46.    public void actionPerformed(ActionEvent e) {
  47.       if (((EventObject)e).getSource() == this.getButton1()) {
  48.          this.conn1(e);
  49.       }
  50.  
  51.    }
  52.  
  53.    private void conn0(WindowEvent arg1) {
  54.       try {
  55.          ((Window)this).dispose();
  56.       } catch (Throwable ivjExc) {
  57.          this.handleException(ivjExc);
  58.       }
  59.  
  60.    }
  61.  
  62.    private void conn1(ActionEvent arg1) {
  63.       try {
  64.          ((Window)this).dispose();
  65.       } catch (Throwable ivjExc) {
  66.          this.handleException(ivjExc);
  67.       }
  68.  
  69.    }
  70.  
  71.    private Button getButton1() {
  72.       if (this.ivjButton1 == null) {
  73.          try {
  74.             this.ivjButton1 = new Button();
  75.             this.ivjButton1.setName("Button1");
  76.             this.ivjButton1.setLabel("Close");
  77.          } catch (Throwable ivjExc) {
  78.             this.handleException(ivjExc);
  79.          }
  80.       }
  81.  
  82.       return this.ivjButton1;
  83.    }
  84.  
  85.    private Label getLabel1() {
  86.       if (this.ivjLabel1 == null) {
  87.          try {
  88.             this.ivjLabel1 = new Label();
  89.             this.ivjLabel1.setName("Label1");
  90.             this.ivjLabel1.setFont(new Font("dialog", 1, 36));
  91.             this.ivjLabel1.setText("JUnit");
  92.          } catch (Throwable ivjExc) {
  93.             this.handleException(ivjExc);
  94.          }
  95.       }
  96.  
  97.       return this.ivjLabel1;
  98.    }
  99.  
  100.    private Label getLabel2() {
  101.       if (this.ivjLabel2 == null) {
  102.          try {
  103.             this.ivjLabel2 = new Label();
  104.             this.ivjLabel2.setName("Label2");
  105.             this.ivjLabel2.setFont(new Font("dialog", 2, 14));
  106.             this.ivjLabel2.setText("By Kent Beck and Erich Gamma");
  107.          } catch (Throwable ivjExc) {
  108.             this.handleException(ivjExc);
  109.          }
  110.       }
  111.  
  112.       return this.ivjLabel2;
  113.    }
  114.  
  115.    private Logo getLogo1() {
  116.       if (this.ivjLogo1 == null) {
  117.          try {
  118.             this.ivjLogo1 = new Logo();
  119.             this.ivjLogo1.setName("Logo1");
  120.          } catch (Throwable ivjExc) {
  121.             this.handleException(ivjExc);
  122.          }
  123.       }
  124.  
  125.       return this.ivjLogo1;
  126.    }
  127.  
  128.    private void handleException(Throwable exception) {
  129.    }
  130.  
  131.    private void initConnections() {
  132.       ((Window)this).addWindowListener(this);
  133.       this.getButton1().addActionListener(this);
  134.    }
  135.  
  136.    private void initialize() {
  137.       GridBagConstraints constraintsLabel1 = new GridBagConstraints();
  138.       GridBagConstraints constraintsLabel2 = new GridBagConstraints();
  139.       GridBagConstraints constraintsButton1 = new GridBagConstraints();
  140.       GridBagConstraints constraintsLogo1 = new GridBagConstraints();
  141.       ((Component)this).setName("AboutDialog");
  142.       ((Component)this).setName("AboutDialog");
  143.       ((Dialog)this).setResizable(false);
  144.       ((Container)this).setLayout(new GridBagLayout());
  145.       ((Component)this).setSize(296, 138);
  146.       ((Dialog)this).setTitle("About");
  147.       constraintsLabel1.gridx = 3;
  148.       constraintsLabel1.gridy = 0;
  149.       constraintsLabel1.gridwidth = 1;
  150.       constraintsLabel1.gridheight = 1;
  151.       constraintsLabel1.anchor = 10;
  152.       constraintsLabel1.weightx = (double)0.0F;
  153.       constraintsLabel1.weighty = (double)0.0F;
  154.       ((GridBagLayout)((Container)this).getLayout()).setConstraints(this.getLabel1(), constraintsLabel1);
  155.       ((Container)this).add(this.getLabel1());
  156.       constraintsLabel2.gridx = 2;
  157.       constraintsLabel2.gridy = 1;
  158.       constraintsLabel2.gridwidth = 2;
  159.       constraintsLabel2.gridheight = 1;
  160.       constraintsLabel2.anchor = 10;
  161.       constraintsLabel2.weightx = (double)0.0F;
  162.       constraintsLabel2.weighty = (double)0.0F;
  163.       ((GridBagLayout)((Container)this).getLayout()).setConstraints(this.getLabel2(), constraintsLabel2);
  164.       ((Container)this).add(this.getLabel2());
  165.       constraintsButton1.gridx = 2;
  166.       constraintsButton1.gridy = 2;
  167.       constraintsButton1.gridwidth = 2;
  168.       constraintsButton1.gridheight = 1;
  169.       constraintsButton1.anchor = 10;
  170.       constraintsButton1.weightx = (double)0.0F;
  171.       constraintsButton1.weighty = (double)0.0F;
  172.       constraintsButton1.insets = new Insets(8, 0, 8, 0);
  173.       ((GridBagLayout)((Container)this).getLayout()).setConstraints(this.getButton1(), constraintsButton1);
  174.       ((Container)this).add(this.getButton1());
  175.       constraintsLogo1.gridx = 2;
  176.       constraintsLogo1.gridy = 0;
  177.       constraintsLogo1.gridwidth = 1;
  178.       constraintsLogo1.gridheight = 1;
  179.       constraintsLogo1.anchor = 10;
  180.       constraintsLogo1.weightx = (double)0.0F;
  181.       constraintsLogo1.weighty = (double)0.0F;
  182.       ((GridBagLayout)((Container)this).getLayout()).setConstraints(this.getLogo1(), constraintsLogo1);
  183.       ((Container)this).add(this.getLogo1());
  184.       this.initConnections();
  185.    }
  186.  
  187.    public static void main(String[] args) {
  188.       try {
  189.          AboutDialog aAboutDialog = new AboutDialog(new Frame());
  190.          ((Dialog)aAboutDialog).setModal(true);
  191.  
  192.          try {
  193.             Class aCloserClass = Class.forName("uvm.abt.edit.WindowCloser");
  194.             Class[] parmTypes = new Class[]{class$java$awt$Window != null ? class$java$awt$Window : (class$java$awt$Window = class$("java.awt.Window"))};
  195.             Object[] parms = new Object[]{aAboutDialog};
  196.             Constructor aCtor = aCloserClass.getConstructor(parmTypes);
  197.             aCtor.newInstance(parms);
  198.          } catch (Throwable var6) {
  199.          }
  200.  
  201.          ((Component)aAboutDialog).setVisible(true);
  202.       } catch (Throwable var7) {
  203.          System.err.println("Exception occurred in main() of java.awt.Dialog");
  204.       }
  205.  
  206.    }
  207.  
  208.    public void windowActivated(WindowEvent e) {
  209.    }
  210.  
  211.    public void windowClosed(WindowEvent e) {
  212.    }
  213.  
  214.    public void windowClosing(WindowEvent e) {
  215.       if (((EventObject)e).getSource() == this) {
  216.          this.conn0(e);
  217.       }
  218.  
  219.    }
  220.  
  221.    public void windowDeactivated(WindowEvent e) {
  222.    }
  223.  
  224.    public void windowDeiconified(WindowEvent e) {
  225.    }
  226.  
  227.    public void windowIconified(WindowEvent e) {
  228.    }
  229.  
  230.    public void windowOpened(WindowEvent e) {
  231.    }
  232.  
  233.    // $FF: synthetic method
  234.    static Class class$(String class$) {
  235.       try {
  236.          return Class.forName(class$);
  237.       } catch (ClassNotFoundException forName) {
  238.          throw new NoClassDefFoundError(((Throwable)forName).getMessage());
  239.       }
  240.    }
  241. }
  242.